Bug 547449 – Entry/ Combo popup misplaced after resize
authorChristian Dywan <cdywan@src.gnome.org>
Wed, 3 Sep 2008 12:38:32 +0000 (12:38 +0000)
committerChristian Dywan <cdywan@src.gnome.org>
Wed, 3 Sep 2008 12:38:32 +0000 (12:38 +0000)
svn path=/trunk/; revision=21263

ChangeLog
gtk/gtkcombobox.c
gtk/gtkentry.c

index 8699550df08f19fcd9661190d5c2cf1b63fe1b57..5b0f73aa0578613582136fd8a5976d34d2819843 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2008-09-03  Christian Dywan  <christian@imendio.com>
+
+       Bug 547449 – Entry/ Combo popup misplaced after resize
+
+       * gtk/gtkcombobox.c (gtk_combo_box_menu_position),
+       (gtk_combo_box_size_allocate): reposition the combo popup when the
+        allocation changes
+       * gtk/gtkentry.c (gtk_entry_size_allocate): reposition the
+        completion popup when the allocation changes
+
 2008-09-03  Michael Natterer  <mitch@imendio.com>
 
        * gtk/gtkmenu.c (get_arrows_visible_area): proper function header
index 1255e7c0e113d09a456517a8099defbb7e33dc53..df6b60109423de4dff534bb73d9bcb5262b34888 100644 (file)
@@ -1605,8 +1605,9 @@ gtk_combo_box_menu_position (GtkMenu  *menu,
       gtk_combo_box_menu_position_over (menu, x, y, push_in, user_data);
     }
 
-  gtk_window_set_type_hint (GTK_WINDOW (GTK_MENU (priv->popup_widget)->toplevel),
-                            GDK_WINDOW_TYPE_HINT_COMBO);
+  if (!GTK_WIDGET_VISIBLE (GTK_MENU (priv->popup_widget)->toplevel))
+    gtk_window_set_type_hint (GTK_WINDOW (GTK_MENU (priv->popup_widget)->toplevel),
+                              GDK_WINDOW_TYPE_HINT_COMBO);
 }
 
 static void
@@ -2293,6 +2294,23 @@ gtk_combo_box_size_allocate (GtkWidget     *widget,
               child.width -= child.x;
             }
 
+          if (GTK_WIDGET_VISIBLE (priv->popup_widget))
+            {
+              gint width;
+              GtkRequisition requisition;
+
+              /* Warning here, without the check in the position func */
+              gtk_menu_reposition (GTK_MENU (priv->popup_widget));
+              if (priv->wrap_width == 0)
+                {
+                  width = GTK_WIDGET (combo_box)->allocation.width;
+                  gtk_widget_set_size_request (priv->popup_widget, -1, -1);
+                  gtk_widget_size_request (priv->popup_widget, &requisition);
+                  gtk_widget_set_size_request (priv->popup_widget,
+                    MAX (width, requisition.width), -1);
+               }
+            }
+
          child.width = MAX (1, child.width);
          child.height = MAX (1, child.height);
           gtk_widget_size_allocate (GTK_BIN (widget)->child, &child);
@@ -2362,6 +2380,15 @@ gtk_combo_box_size_allocate (GtkWidget     *widget,
           child.width -= delta_x * 2;
           child.height -= delta_y * 2;
         }
+
+      if (GTK_WIDGET_VISIBLE (priv->popup_window))
+        {
+          gint x, y, width, height;
+          gtk_combo_box_list_position (combo_box, &x, &y, &width, &height);
+          gtk_window_move (GTK_WINDOW (priv->popup_window), x, y);
+          gtk_widget_set_size_request (priv->popup_window, width, height);
+        }
+
       
       child.width = MAX (1, child.width);
       child.height = MAX (1, child.height);
index 4383057ee354dcb2f92a86c35505c53876269ff0..76d17b64ab27d229b6d90e5a5a517a6ba77f7860 100644 (file)
@@ -1581,6 +1581,7 @@ gtk_entry_size_allocate (GtkWidget     *widget,
        * be affected by the usize of the entry, if set
        */
       gint x, y, width, height;
+      GtkEntryCompletion* completion;
 
       get_widget_window_size (entry, &x, &y, &width, &height);
       
@@ -1593,6 +1594,10 @@ gtk_entry_size_allocate (GtkWidget     *widget,
                               x, y, width, height);
 
       gtk_entry_recompute (entry);
+
+      completion = gtk_entry_get_completion (entry);
+      if (completion && GTK_WIDGET_MAPPED (completion->priv->popup_window))
+        _gtk_entry_completion_resize_popup (completion);
     }
 }